home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programming Sound Cards
/
Programming Sound Cards.iso
/
sound_26
/
whooper.asm
< prev
next >
Wrap
Assembly Source File
|
1995-01-01
|
3KB
|
54 lines
code_seg segment
assume cs:code_seg
org 100h
jmp start
;-------------------------------------------
;B/C Software ;Author
;520 North Stateline Rd
;Sharon, Pa 16146
;----------------------------------
message1 db 'press Esc to Quit',0dh,0ah,'$' ;Esc to end whooper
message2 db 'press any other key to play$' ;or to go again
;----------------------------------
start proc near
mov ah,9 ;DOS function number to print string
mov dx,offset message1 ;the message
int 21h ;DOS interrupt
mov ah,9 ;DOS function number to print string
mov dx,offset message2 ;the message
int 21h ;DOS interrupt
begin: mov ah,0 ;BIOS function wait for key press
int 16h ;BIOS interrupt
cmp ah,1 ;Esc scan code
jz done ;do we stop ?
call whooper ;no call whooping sound
jmp begin ;go see if we do it again
done: mov ax,4c00h ;no exit back to DOS
int 21h ;DOS interrupt
start endp
;-------------------------------------------
whooper proc near
cli ;no interrupts
backery:mov bx,5000 ;start frequency low
mov al,10110110xb ;channel 2
out 43h,al ;send it
backerx:mov ax,bx ;place frequency in (ax)
out 42h,al ;send LSB first
mov al,ah ;place MSB in al
out 42h,al ;send it next
in al,61h ;lets turn the speaker on
or al,00000011xb ;this number will do it
out 61h,al ;send it
mov cx,50 ;50 is best for (8mhz clock)
looperx:loop looperx ;delay so we can hear sound
dec bx ;decremnent repeat count
jnz backerx ;if not = 0 go do again
in al,61h ;if were done - turn speaker off
and al,11111100xb ;this number will do it
out 61h,al ;send it
sti ;enable interrupts
ret ;go see if user wants to go again
whooper endp
;----------------------------------
code_seg segment